<? php
//category.php:
	/**
	 * 向教师列表添加内容
	 */
	function AddTeacher(){
		$this->mysmarty->assign('active','document');
		$data=LfDealArray::InitArray(array('Id','Name','Pid','Description',"Sort",'Image','JobTitle','Education','Department','Email','Phone','Experience','Research','Prize','Outstanding'));
		$data[0]['Pid']=LfRequest::JudgeRequst('Pid');
		$this->mysmarty->assign('info',@$_SESSION['info']);
		$_SESSION['info']='';
		$outstanding=$this->db->get('outstandingtype')->result_array();
		$this->mysmarty->assign('outstanding',$outstanding);
		$this->mysmarty->assign('category',$this->category);
		//$this->mysmarty->assign('lastcate',$this->lastTeachercate);		
		//找到当前待添加内容所属栏目的栏目名称
		$lastcate = $this->lastTeachercate;
		foreach ($lastcate as $c) {
			if ($c['Id'] == $data[0]['Pid']){
				$Pcate = $c['CateName'];
				break;
			}
		}
		//若没有获取到栏目名称则报错
		if (empty($Pcate)){
			show_error(iconv("utf-8","gb2312//IGNORE","栏目获取出错！"));
		}
		$this->mysmarty->assign('Method','Add');
		$this->mysmarty->assign('teacher',$data);
		$this->mysmarty->assign('Pcate',$Pcate);
		$this->mysmarty->display('admin/teacher_edit.tpl');
	}

//teacher_edit.tpl:
	<label>所属栏目：</label>
	<select name="Pid" class="form-control">
		<option value="{{$teacher.0.Pid}}" >{{$Pcate}}</option>
		<!--option value="{{$c.Id}}" {{if $teacher.0.Pid==$c.Id}}selected='selected'{{/if}} >{{$c.CateName}}</option-->
	</select>